#ifndef GOODINFOEDITOR_H
#define GOODINFOEDITOR_H

#include <QDialog>

namespace Ui {
class GoodInfoEditor;
}

class GoodInfo;

enum EditorOpenType{ ChangeInfo = 1,AddInfo = 2 };
class GoodInfoEditor : public QDialog
{
    Q_OBJECT
public:
    // 添加构造函数
    explicit GoodInfoEditor(EditorOpenType open_type,QWidget *parent = 0);

    // 修改构造函数
    GoodInfoEditor(EditorOpenType open_type, GoodInfo *info, QWidget *parent = 0);
    ~GoodInfoEditor();

private slots:
    void on_choose_btn_clicked();

    void on_save_btn_clicked();

    void on_close_btn_clicked();

private:
    Ui::GoodInfoEditor *ui;
    EditorOpenType m_open_type;
    GoodInfo *m_good_info;

private:
    void Init();
    void ShowMessage(QString msg);
    GoodInfo GetCurGoodInfo();
    void SetImage(QString set_img_name);
public:
    const QString DEFAULT_IMG_PATH = QString(":/images/CheckFail.jpg");
};

#endif // GOODINFOEDITOR_H
